package com.offcn.listener;


import com.alibaba.otter.canal.protocol.CanalEntry;
import com.xpand.starter.canal.annotation.CanalEventListener;
import com.xpand.starter.canal.annotation.DeleteListenPoint;
import com.xpand.starter.canal.annotation.InsertListenPoint;
import com.xpand.starter.canal.annotation.UpdateListenPoint;

import java.util.function.Consumer;

@CanalEventListener
public class CanalDataEventListener {

    /**
     * 监听添加
     */
    @InsertListenPoint
    public void onEvenInsert(CanalEntry.RowData rowData){
        rowData.getAfterColumnsList().forEach(
                new Consumer<CanalEntry.Column>() {
                    @Override
                    public void accept(CanalEntry.Column column) {
                        System.out.println("新增的数据：" + column.getName() + ",新增的值:" + column.getValue());
                    }
                }
        );
    }

    
}

